furny.furndb.importer
Class FurnDBImporter

java.lang.Object
  extended by furny.furndb.importer.FurnDBImporter
All Implemented Interfaces:
RenderThumbnailState.RenderListener

public class FurnDBImporter
extends java.lang.Object
implements RenderThumbnailState.RenderListener

This class imports furnitures from the OgreXML format. The importer needs a JME application during import to render thumbnail images. There are two ways that depend on the constructor being used: create a new application or use an existing one.

Since:
10.08.2012
Author:
Stephan Dreyer

Nested Class Summary
static class FurnDBImporter.ExitMode
          The exit mode describes what the importer should do after an import.
static interface FurnDBImporter.ImportListener
          Interface to observe import state.
 
Field Summary
private  Furniture actFurn
           
private  com.jme3.app.SimpleApplication app
           
private  FurnDBImporter.ExitMode exitMode
           
private  java.lang.String lastAssetPath
           
private  FurnDBImporter.ImportListener listener
           
private static java.util.logging.Logger LOGGER
           
private  IModelSource modelSource
           
private  RenderThumbnailState rtt
           
 
Constructor Summary
FurnDBImporter()
          Constructor that creates a new JME application.
FurnDBImporter(com.jme3.app.SimpleApplication app)
          Constructor that uses an existing JME application.
 
Method Summary
private  void checkForExit()
          Checks for the action to perform depending on the exit mode.
 void importModelsFromFiles(java.lang.String assetPath, java.util.List<java.io.File> files, FurnDBImporter.ImportListener listener)
          Imports models from a list of files.
 void importModelsFromPath(java.lang.String assetPath)
          Imports models from a file path.
static void main(java.lang.String[] args)
          A main class to test behavior.
 void renderingCompleted(java.lang.String id, java.awt.image.BufferedImage image)
          This listener methods is called when the rendering of the id is complete.
private  void renderThumbNail(Furniture f)
          Renders a thumbnail for the given furniture.
 void savingCompleted(java.lang.String id, java.io.File file)
          This listener method is called when the rendered image has been saved to a file.
 void setExitMode(FurnDBImporter.ExitMode exitMode)
          Sets the FurnDBImporter.ExitMode for this importer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

modelSource

private IModelSource modelSource

rtt

private final RenderThumbnailState rtt

actFurn

private Furniture actFurn

exitMode

private FurnDBImporter.ExitMode exitMode

app

private final com.jme3.app.SimpleApplication app

listener

private FurnDBImporter.ImportListener listener

lastAssetPath

private java.lang.String lastAssetPath
Constructor Detail

FurnDBImporter

public FurnDBImporter()
Constructor that creates a new JME application.

Since:
10.08.2012

FurnDBImporter

public FurnDBImporter(com.jme3.app.SimpleApplication app)
Constructor that uses an existing JME application.

Parameters:
app - The application to use for rendering.
Since:
10.08.2012
Method Detail

importModelsFromPath

public void importModelsFromPath(java.lang.String assetPath)
Imports models from a file path.

Parameters:
assetPath - The path where the files are located.
Since:
10.08.2012

importModelsFromFiles

public void importModelsFromFiles(java.lang.String assetPath,
                                  java.util.List<java.io.File> files,
                                  FurnDBImporter.ImportListener listener)
Imports models from a list of files.

Parameters:
assetPath - The path where the files are located.
files - The list of files to import.
listener - The listener to notify about import process.
Since:
10.08.2012

setExitMode

public void setExitMode(FurnDBImporter.ExitMode exitMode)
Sets the FurnDBImporter.ExitMode for this importer. This must be done before importing models.

Parameters:
exitMode - The exit mode.
Since:
10.08.2012

renderThumbNail

private void renderThumbNail(Furniture f)
Renders a thumbnail for the given furniture.

Parameters:
f - The furniture to render a thumbnail for.
Since:
10.08.2012

renderingCompleted

public void renderingCompleted(java.lang.String id,
                               java.awt.image.BufferedImage image)
Description copied from interface: RenderThumbnailState.RenderListener
This listener methods is called when the rendering of the id is complete. It also contains the rendered image.

Specified by:
renderingCompleted in interface RenderThumbnailState.RenderListener
Parameters:
id - The id of the rendered node
image - The rendered image

savingCompleted

public void savingCompleted(java.lang.String id,
                            java.io.File file)
Description copied from interface: RenderThumbnailState.RenderListener
This listener method is called when the rendered image has been saved to a file.

Specified by:
savingCompleted in interface RenderThumbnailState.RenderListener
Parameters:
id - The id of the rendered node
file - The file to which the image has been saved

checkForExit

private void checkForExit()
Checks for the action to perform depending on the exit mode.

Since:
10.08.2012

main

public static void main(java.lang.String[] args)
A main class to test behavior.

Parameters:
args - Args
Since:
10.08.2012